﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PartialApplication;

namespace TestObjectAsArray {
    internal class Program {
        private static void Main( string[] args ) {
            Func< Func< long, long, long >, long, IEnumerable< long >, long > reduce1 = HigherOrder.GetReduce< long >();
            
            var reduce = HigherOrder.GetReduce< long >().Curry();
            var getProduct = reduce( ( x, y ) => x*y )( 1 );
            
            var sequence = HigherOrder.GetSequence< long >().Curry();
            var numbersFromOneToX = sequence( x => ++x )( 1 );
            
            var factorialOf10 = getProduct( numbersFromOneToX( x => x == 10 ) );

            Console.WriteLine( "Factorial of 10 is {0:#,#}", factorialOf10 );
            Console.ReadLine();
        }
    }
}